import Vue from 'vue'
import Vuex from 'vuex'
import map from '../utils/map'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: null,
    roleid: null,
    address: [],
    classinfo: {},
    levelinfo: {},
    map,
    // belly
    users: '',
    agent: '',
    agenter: '',
    position: '',
    phone: '',
    role: '',
    passdata: [],
    roles: [
      { role: 1001, name: '国家级' },
      { role: 1002, name: '省级' },
      { role: 1003, name: '市级' },
      { role: 1004, name: '区县级' },
      { role: 1005, name: '学校级' },
      { role: 1006, name: '班级级' }
    ],
    guijiItem: {},
    userInfo: {}
  },
  getters: {

  },
  mutations: {
    login(state, userInfo) {
      state.user = userInfo.user
      state.roleid = userInfo.roleid
      state.address = userInfo.adress
      state.classinfo = userInfo.classinfo
      state.levelinfo = userInfo.levelinfo
    },
    changeStudy ({ classinfo }, study) {
      classinfo.study = study
    },
    changeagent(state, item) {
      state.agent = item
    },
    changeagenter(state, item) {
      state.agenter = item
    },
    changeuser(state, item) {
      state.users = item
    },
    changephone(state, item) {
      state.phone = item
    },
    changerole(state, item) {
      state.role = item
    },
    changeposition(state, item) {
      state.position = item
    },
    setGuijiItem(state, item) {
      state.guijiItem = item
    },
    userInfo(state, item) {
      state.userInfo = item
    }
  },
  actions: {

  }
})
